package com.xxx.fallback;


import com.xxx.feignclients.MediaFeignClient;
import com.xxx.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class MediaFeignClientFallbackFallback implements FallbackFactory<MediaFeignClient> {

    @Override
    public MediaFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return new MediaFeignClient() {
            @Override
            public JSONResult getByCourseId(Long courseId) {
                return JSONResult.error("调用媒体服务MediaController#getByCourseID服务出错了!");
            }
        };
    }
}
